package main;

public class GameController {
	
	private Field field;
	
	private IOController ioController;
	
	// Initialization of GameControllor
	public GameController(IOController ioController){
		this.ioController = ioController;
		field = new Field();
		this.ioController.setField(field);
	}
	
	//start game
	public void startGame(){
		this.ioController.showNewRoundScreen();
	}
	
	// Control the game flow
	public void process(int x, int y){
		if(field.isBomb(x, y))
			ioController.showEndGameScreen();
		else if(field.isClicked(x, y))
			ioController.showNewRoundScreen();
		else if(field.isEmpty(x, y)){
			field.clickOn(x, y);
			ioController.showNewRoundScreen();
		}
	}
}